﻿@{
    Layout = "~/Views/Shared/_PopupLayout.cshtml";
}

@model LineOfBusiness.Poco.AD_tblUserAccountPolicy

@Html.LOBHtmlHelper().Busy("pupopBusy")
@{Html.LOBHtmlHelper().tdLable("180");}


<style>
 fieldset {
    margin: 8px;
    border: 1px solid silver;
    padding: 8px;    
    border-radius: 4px;
}
legend{
    padding: 2px;        
}
</style>

<div>
    <form id="frm">
         <fieldset>
            <legend><strong>@Html.LOBHtmlHelper().Label("lblSetingSecurity", "Setting Security")</strong></legend>
            <table style="width:100%">                    
                <tr>
                    <td>             
                        @Html.LOBHtmlHelper().CheckBoxFor(c => c.StrongSecurity)                
                        @Html.LOBHtmlHelper().Label("lblStrongSecurity", "Apply a high security policy ")
                    </td>
                </tr>
            </table>    
        </fieldset>

        <fieldset>
            <legend><strong>@Html.LOBHtmlHelper().Label("lblSetingSecurity", "Base Setting")</strong></legend>
            <table style="width:100%">                    
                <tr>
                    <td style="width:200px">             
                        @Html.LOBHtmlHelper().Label("lblMinimunPwdLen", "Minimun password lenght")
                    </td>
                    <td style="width:50px">             
                        @Html.LOBHtmlHelper().InputFor("MinimunPwdLen", InputType.Text, 0)
                    </td>
                    <td style="width:100px">             
                        @Html.LOBHtmlHelper().Label("lblMinimunPwdLenChar", "Characters")
                    </td>
                </tr>

                <tr>
                    <td style="width:200px">             
                        @Html.LOBHtmlHelper().Label("lblNoPwdHistory", "Member of passwords remember")
                    </td>
                    <td style="width:50px">             
                        @Html.LOBHtmlHelper().InputFor("NoPwdHistory", InputType.Text, 0)
                    </td>
                    <td style="width:100px">             
                        @Html.LOBHtmlHelper().Label("lblNoPwdHistoryTime", "Times")
                    </td>
                </tr>

                 <tr>
                    <td style="width:200px">             
                        @Html.LOBHtmlHelper().Label("lblDaysPwdAge", "Minimum password age")
                    </td>
                    <td style="width:50px">             
                        @Html.LOBHtmlHelper().InputFor("DaysPwdAge", InputType.Text, 0)
                    </td>
                    <td style="width:100px">             
                        @Html.LOBHtmlHelper().Label("lblDaysPwdAgeDay", "Days")
                    </td>
                </tr>

                 <tr>
                    <td style="width:200px">             
                        @Html.LOBHtmlHelper().Label("lblWarningBeforeExpire", "Show an alert password expire before")
                    </td>
                    <td style="width:50px">             
                        @Html.LOBHtmlHelper().InputFor("WarningBeforeExpire", InputType.Text, 0)
                    </td>
                    <td style="width:100px">             
                        @Html.LOBHtmlHelper().Label("lblWarningBeforeExpireDay", "Days")
                    </td>
                </tr>
            </table>    
        </fieldset>

        <fieldset>
            <legend><strong>@Html.LOBHtmlHelper().Label("lblSetingSecurity", "Advance Setting")</strong></legend>
            <table style="width:100%">                    
                <tr>
                    <td style="width:200px">             
                        @Html.LOBHtmlHelper().Label("lblNoOfWrongPwd", "When user enter wrong password")
                    </td>
                    <td style="width:50px">             
                        @Html.LOBHtmlHelper().InputFor("NoOfWrongPwd", InputType.Text, 0)
                    </td>
                    <td style="width:100px">             
                        @Html.LOBHtmlHelper().Label("lblNoOfWrongPwdTime", "Time")
                    </td>
                </tr>

                 <tr>
                    <td style="width:200px">             
                        <input id="radDeactive" style="margin-left:20px" name="rad" type="radio" value="T" checked="checked" />
                        @Html.LOBHtmlHelper().Label("lblDeactive", "Set deactive user")
                        @Html.LOBHtmlHelper().InputFor("WrongPwd", InputType.Hidden, 0)
                    </td>
                    <td style="width:50px">             
                        
                    </td>
                    <td style="width:100px">             
                        
                    </td>
                </tr>

                <tr>
                    <td style="width:200px">             
                        <input id="radFreeze" style="margin-left:20px" name="rad" type="radio" value="C" />
                        @Html.LOBHtmlHelper().Label("lblSuspend", "Suspend system")
                    </td>
                    <td style="width:50px">             
                        @Html.LOBHtmlHelper().InputFor("FreezeSystemIn", InputType.Text, 0)
                    </td>
                    <td style="width:100px">             
                        
                    </td>
                </tr>
                 
            </table>    
        </fieldset>
    </form>
</div>

<div class="Line">
</div>

<div  style="text-align:right">
    <div class="buttons">
        @if(ViewBag.Edit!=-1)
        {
            <button id="btnSave" class="positive" onclick= "SavePopup()">
                <img src="@Html.BaseUrl()Content/images/toolbar/save.png" alt="" /> 
                @Html.LOBHtmlHelper().C("Save")
            </button> 
        }
        <button class="positive" onclick= "Close()">
            <img src="@Html.BaseUrl()Content/images/toolbar/close.png" alt="" /> 
            @Html.LOBHtmlHelper().C("Close")
        </button> 
    </div>
</div>

<script type="text/javascript">

    var codeBasePopup = new CodeBasePopup();

    $(document).ready(function () {

        codeBasePopup.init('@ViewBag.Edit', "ID", "@Url.Action("Save","UserAccountPolicy")", '@Model.ID', "", 80);
        codeBasePopup.IsReadOnly("FreezeSystemIn", true);
        
        $('input:radio').change(
                function () {
                    if (this.id == "radDeactive") {
                        codeBasePopup.IsReadOnly("FreezeSystemIn", true);
                        $("#WrongPwd").val("1");
                    }
                    else {
                        codeBasePopup.IsReadOnly("FreezeSystemIn", false);
                        $("#WrongPwd").val("0");
                    }
                }
            );
    });

    function SavePopup() {
        codeBasePopup.SavePopup();
    }

    function Close() {
        codeBasePopup.Close();
    }

    function PopupSaveCompleted() {
        CloseWin(0, idWindow);
        return true;
    }

</script>